Hi!
I'm trying to print 4 lines with dinamic values without using "\n". Everyting works just fine when I use only one line. And the code is:
The way it is now it'll only print the last line an "update" it with new values.Code:while (1){ num1=rand()%100; num2=rand()%100; num3=rand()%100; num4=rand()%100; printing(num1,num2,num3,num4); usleep(500000); } void printing(int num1,int num2,int num3,int num4){ fprintf(stderr,"\rActPos:\t%d\t%d\t%d\t%d",num1,num2,num3,num4); fprintf(stderr,"\rOptPos:\t%d\t%d\t%d\t%d",num1,num2,num3,num4); fprintf(stderr,"\rTrgPos:\t%d\t%d\t%d\t%d",num1,num2,num3,num4); fprintf(stderr,"\rFlwErr:\t%d\t%d\t%d\t%d",num1,num2,num3,num4); }
If i try to use "\n" before every "\r" the result is not what i expect because i only want to see 4 line in the command prompt with refreshed values every 0.5 seconds.
What is the best way to accomplish my objective?

